package android.slc.module.sys.ui.dict.data

import android.slc.appbase.ui.AppStageLauncherConfigSimple
import android.slc.box.core.utils.ViewUtils
import javafx.stage.Modality
import javafx.stage.Stage

object DictDataViewConfig {

    fun getPageLauncherConfig(): AppStageLauncherConfigSimple {
        return object : AppStageLauncherConfigSimple() {
            override fun initStage(ownerStage: Stage?, currentStage: Stage) {
                super.initStage(ownerStage, currentStage)
                currentStage.initOwner(ownerStage)
                currentStage.initModality(Modality.WINDOW_MODAL)
            }
        }
    }

    fun getEditLauncherConfig(): AppStageLauncherConfigSimple {
        return object : AppStageLauncherConfigSimple() {
            override fun initStage(ownerStage: Stage?, currentStage: Stage) {
                super.initStage(ownerStage, currentStage)
                currentStage.initOwner(ownerStage)
                currentStage.initModality(Modality.WINDOW_MODAL)
            }

            override fun setStageParamsRunLast(currentStage: Stage) {
                currentStage.minWidth = ViewUtils.getAppWindowMinWidth() / 2
                currentStage.minHeight = 0.0
                currentStage.centerOnScreen()
            }
        }
    }
}